Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Graphics /
Chapter 3 - Geometric Styles / Geometric Styles Reference
Constants and Data Types


The Dash Structure

With QuickDraw GX, you can specify that certain shapes should be drawn with dashed, instead of solid, contours. In particular, you may specify a dash for any line, curve, rectangle, polygon, or path shape that has an open-frame shape fill or a closed-frame shape fill.

QuickDraw GX uses the dash property of a shape's style object to store information about how to dash the shape.

You use the dash structure when specifying dash information (using the GXSetStyleDash or GXSetShapeDash functions) and when retrieving dash information (using the GXGetStyleDash or GXGetShapeDash functions).

The dash structure is defined by the gxDashRecord data type:

struct gxDashRecord {
   gxDashAttribute   attributes;
   gxShape           dash;    
   Fixed             advance; 
   fract             phase;   
   Fixed             scale;/
};
Field Description
attributes
Modifies the behavior of the dashes. The next section, "Dash Attributes," describes the gxDashAttribute flags in detail.
dash
Specifies what the dash should look like. You must use shapes in their primitive form for the dash shape. (Primitive shapes are described in detail in Chapter 4, "Geometric Operations," in this book.) You may not use text shapes, layout shapes, bitmap shapes, or picture shapes as the dash shape. However, you may use framed shapes and glyph, and you may also use shapes with an inverse shape fill if the clip dash attribute is set.
QuickDraw GX considers only the geometric properties (the shape type, the shape fill, and the shape geometry) of the shape specified by the dash field. QuickDraw GX ignores the owner count, shape tags, and shape attributes properties and the style, ink, and transform objects of the dash shape.
advance
Indicates the distance between dashes. This fixed-point value is the distance along the contours of the dashed shape between the beginning of a dash and the beginning of the following dash. The value must be greater than 0.
phase
Specifies the initial placement of a dash. This value can vary between -2.0 and 2.0. A value of 0 indicates that the dash shape should not be offset--that is, the start of the first dash shape should be aligned with the start of the contour. A value greater than 0 indicates that the first dash along the contour should begin a certain percentage into the dash shape. A value of 1.0 indicates that the dashes should be shifted exactly one advance width--this value is equivalent to specifying a value of 0. Values greater than 1.0 are equivalent to their fractional part.
scale
Specifies the scaling of the dash shape. QuickDraw GX scales the dash shape in one dimension--perpendicularly to the contour being dashed. The factor it uses to scales the dash shape in this dimension is the pen with divided by the dash scale. Therfore, decreasing the dash scale has the effect of thickening the dashed contour.
See "Dashes" beginning on page 3-27 for more information about dashes, and see page 3-66 through page 3-81 for examples of dashing.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996